
#include <SoftwareSerial.h>
SoftwareSerial XBee(2, 3);
int pin = 13;
String MYXBEEID = "";
char IDByte;
char checkByte;

void setup(){

  Serial.begin(9600);
  Serial.println("Connected to computer");

  XBee.begin(9600);
  Serial.println("Connected to XBee module");
  XBee.print("+++"); //coomunicate to the XBee modudle
  delay(2000);

  if(XBee.available() > 1){
    checkByte = XBee.read();
    XBee.println("ATMY");
    
    Serial.println("Checking ID Number");
      while(XBee.available()){
        
        IDByte = (int)XBee.read();
        Serial.println(IDByte);
        MYXBEEID += IDByte;
      }
      
      Serial.print("I got the ID number: ");
      Serial.println(MYXBEEID);
    }
  }


char inByte = 0;
void loop(){

  if (XBee.available()){
    Serial.print("WOOT, I GOT A MESSAGE: ");
    inByte = XBee.read();
    Serial.println(inByte);
    XBee.print(MYXBEEID);
    XBee.print("I have gotten: ");
    XBee.println(inByte);

  }
  delay(1000);

}






